updating oE call

Calling Into Memory

call

<built-in> procedure call(atom addr) 

calls a machine language routine which was stored in memory prior.

Parameters:
  1. addr : an atom, the address at which to transfer execution control.
Comments:

The machine code routine must execute a RET instruction #C3 to return control to Euphoria. The routine should save and restore any registers that it uses.

You can allocate a block of memory for the routine and then poke in the bytes of machine code using allocate_code. You might allocate other blocks of memory for data and parameters that the machine code can operate on using allocate. The addresses of these blocks could be part of the machine code.

If your machine code uses the stack, use c_proc instead of call.

Example 1:

demo/callmach.ex

See Also:

Executable Memory, allocate_code, free_code, c_proc, define_c_proc

Not Categorized, Please Help

Search



Quick Links

User menu

Not signed in.

Misc Menu